<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta name="author" content="lushu">
		<title>黑交易确认</title>
		<script type="text/javascript" src="../script/common.js" language="JavaScript"></script>
		<script type="text/javascript" language="JavaScript">
			var Page;					//数据表格对象
			
			function initPageElements(){
				Page.tradeForm = $('tradeForm')
				Page.PresetOrg.cardLoc = true;
				Page.OrgLevel.cardLoc = Constants.ORG_LEVEL_CITY;
				Page.sql = "black_trade_list";
				Page.selection.tradeType = {list:Common.getSubsetItems("epstrade_type",[EpsTradeType.CARD,
																						EpsTradeType.BANK,
																						EpsTradeType.CASH]),nullLabel:"全     部"};
				Page.selection.accountType = {list:Clear.AccountType.deposit()};
				Page.operation = Page.operation = {title:"操作",
									width:"5%",
									align:"center",
									render:function(v,r){
												return "<a href=# onclick='editTrade("+r[0]+");'>明细</a>";
											}
								};
			}
			
			function editTrade(id){
				if(!id)
					return;
				DWR.call("txQueryService.getTrade",id,function(trade){
					Page.tradeForm.id.value = id
  					$("station").innerHTML = trade.orgName
					$("blackInterval").innerHTML = parseInt(trade.blackInterval/3600)+ "小时"  
												 //+ parseInt(trade.blackInterval%3600/60) + "分" 
											  	 //+ trade.blackInterval%60 + '秒'
 					$("asn").innerHTML = trade.cardAsn
					$("tradeType").innerHTML = Common.getItem("trade_type",trade.tradeType)['text']
 					$("errorCode").innerHTML = ''
					$("adjustFlag").innerHTML = ''
 					$("recordTime").innerHTML = trade.recordTime.format("yyyy-MM-dd hh:mm:ss")
					$("businessDate").innerHTML = trade.businessDate.format("yyyy-MM-dd")
 					$("accType").innerHTML = Common.getText('account_type',trade.accountType)
					$("balance").innerHTML = Format.fenToYuan(trade.balance)
 					$("amount").innerHTML = Format.fenToYuan(trade.amount)
					$("realAmount").innerHTML = Format.fenToYuan(trade.realAmount)
					switchPage("detailView");
				});
			}

			function confirmBlackTrade(){
				var id = Page.tradeForm.id.value;
				try{
					DWR.syncCall("tradeService.confirmBlackTrade",id)
						showInformation("交易确认成功");
						switchPage('listView')
						ListPage.showListTable();
				}catch(e){
					showError(e.description)
				}
			}
			
		</script>
	</head>
	<body onload="Clear.List.init()">
		<div class="nav"><div id="nav">&nbsp;</div></div>
	
		<div id="listView">
			<div class="searchForm">
				<form id="searchForm" name="searchForm">
					<table cellSpacing="0" cellPadding="4" width="100%" border="0">
						<tr>
							<td class="label5" id="cardLoc"></td>
							<td class="label5">
								<label>帐户类型</label>
								<select name="accountType" onchange="ListPage.changeAccountCode(this)"><option></select>
							</td>
							<td class="label5">
								<label>卡&nbsp;&nbsp;&nbsp;&nbsp;号</label> 
								<input type="text" name="cardAsn" maxlength='16' onblur="checkV(this,'asn')">
							</td>
						</tr>
						<tr>
							<td class="label5" id="beginDateTd"></td>	
							<td class="label5" id="endDateTd"></td>
							<td><button onclick="ListPage.showListTable()">查 询</button></td>
						</tr>
					</table>
				</form>
			</div>
			<div id="datalist"></div>
		</div>
		
		<div id="detailView" style="display:none;">
			<form id="tradeForm" name="tradeForm">
				<div class="form" id="printArea">
					<div class="formTitle">IC卡消费交易明细</div>
					<input id='id' type="hidden">
					<table class='viewTable col2 label5' cellSpacing='0' cellPadding='4' width='100%' border='0'>
						<tr>
							<td><label>交易地点</label> <span id="station"></span></td>
							<td><label>距挂失时间</label> <span id="blackInterval"></span></td>
						</tr>
						<tr>
							<td><label>卡&nbsp;&nbsp;&nbsp;&nbsp;号</label> <span id="asn"></span></td>
							<td><label>交易类型</label> <span id="tradeType"></span></select></td>
						</tr>
						<tr>
							<td><label>异常类型</label> <span id="errorCode"></span></td>
							<td><label>调整类型</label> <span id="adjustFlag"></span></td>
						</tr>
						<!--tr>
							<td><label>调整额</label> <span id="adjustAmount"></span></td>
							<td><label>调整实际金额</label> <span id="adjustRealAmount"></span></td>
						</tr-->
						<tr>
							<td><label>入帐时间</label> <span id="recordTime"></span></td>
							<td><label>业务日期</label> <span id="businessDate"></span></td>
						</tr>
						<tr>
							<td><label>帐户类型</label> <span id="accType"></span></td>
							<td><label>帐户余额</label> <span id="balance"></span></td>
						</tr>
						<tr>
							<td><label>交&nbsp;易&nbsp;额</label> <span id="amount"></span></td>
							<td><label>实际金额</label> <span id="realAmount"></span></td>
						</tr>
					</table>
				</div>
			</form>
			<p>
				<button onclick="confirmBlackTrade()">确认赔偿</button>
				<button onclick="switchPage('listView')">返 回</button>
			</p>
		</div>
	</body>
</html>